package com.example.springbott.wx_service;

import com.example.springbott.bean.MarketFeedback;
import com.example.springbott.mapper.MarketFeedbackMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * 个人中心反馈
 * @author silic xia
 * @since 2022/11/22 17:30
 */
@Service
public class WXFeedbackServiceImpl implements WXFeedbackService{

    @Autowired
    MarketFeedbackMapper feedbackMapper;

    /**
     *  意见反馈 feedback
     *
     * @param {"mobile":"13310000000","feedType":"商品相关","content":"产品有问,"hasPicture":true,
     * "picUrls":["http://182.92.235.201:8083/wx/storage/fetch/6t37wtmgzr5ljkjahs9m.jpeg"]}
     * @return {"errno":401,"errmsg":"参数不对"}
     *          {"errno":0,"errmsg":"成功"}
     * @author  silic xia
     * @since 2022/11/22 17:16
     */
    @Override
    public void wxFeedbackSubmit(MarketFeedback marketFeedback, Integer userId, String username) {
        marketFeedback.setUserId(userId);
        marketFeedback.setUsername(username);
        marketFeedback.setAddTime(new Date());
        marketFeedback.setUpdateTime(new Date());
        marketFeedback.setDeleted(false);
        marketFeedback.setHasPicture(true);
        feedbackMapper.insertSelective(marketFeedback);
    }
}

